{#**
 * 2007-2020 PrestaShop SA and Contributors
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2020 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *#}
<div role="tabpanel" class="form-contenttab tab-pane" id="step3">
  <div class="row">
    <div class="col-md-12">
      <div class="container-fluid">
        <div class="row">

          <div class="col-md-12">

            <div id="quantities" style="{% if has_combinations or formDependsOnStocks.vars.value != "0" %}display: none;{% endif %}">
              <h2>{{ 'Quantities'|trans({}, 'Admin.Catalog.Feature') }}</h2>
              <fieldset class="form-group">
                <div class="row">
                  {% if 'PS_STOCK_MANAGEMENT'|configuration %}
                    <div class="col-md-4">
                      <label class="form-control-label">{{ formStockQuantity.vars.label }}</label>
                      {{ form_errors(formStockQuantity) }}
                      {{ form_widget(formStockQuantity) }}
                    </div>
                  {% endif %}
                  <div class="col-md-4">
                    <label class="form-control-label">{{ formStockMinimalQuantity.vars.label }}</label>
                    <span class="help-box" data-toggle="popover"
                          data-content="{{ "The minimum quantity required to buy this product (set to 1 to disable this feature). E.g.: if set to 3, customers will be able to purchase the product only if they take at least 3 in quantity."|trans({}, 'Admin.Catalog.Help') }}" ></span>
                    {{ form_errors(formStockMinimalQuantity) }}
                    {{ form_widget(formStockMinimalQuantity) }}
                  </div>
                </div>
              </fieldset>

              <h2>{{ 'Stock'|trans({}, 'Admin.Catalog.Feature') }}</h2>
              <fieldset class="form-group">
                <div class="row">
                  <div class="col-md-4">
                    <label class="form-control-label">{{ formLocation.vars.label }}</label>
                    {{ form_errors(formLocation) }}
                    {{ form_widget(formLocation) }}
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-4">
                    <label class="form-control-label">{{ formLowStockThreshold.vars.label }}</label>
                    {{ form_errors(formLowStockThreshold) }}
                    {{ form_widget(formLowStockThreshold) }}
                  </div>
                  <div class="col-md-8">
                    <label class="form-control-label">&nbsp;</label>
                    <div class="widget-checkbox-inline">
                      {{ form_errors(formLowStockAlert) }}
                      {{ form_widget(formLowStockAlert) }}
                      <span class="help-box" data-toggle="popover" data-html="true" data-content="{{ "The email will be sent to all the users who have the right to run the stock page. To modify the permissions, go to [1]Advanced Parameters > Team[/1]"|trans({'[1]':'<a href=&quot;'~getAdminLink("AdminEmployees")~'&quot;>','[/1]':'</a>'}, 'Admin.Catalog.Help')|raw }}" ></span>
                    </div>
                  </div>
                </div>
              </fieldset>
            </div>

            <div id="virtual_product" data-action="{{ path('admin_product_virtual_save_action', { 'idProduct': productId }) }}" data-action-remove="{{ path('admin_product_virtual_remove_action', {'idProduct': productId }) }}">

              <div class="row">
                <div class="col-md-4">
                  <h2>{{ formVirtualProduct.vars.label }}</h2>
                </div>
                <div class="col-md-8">
                  <fieldset class="form-group">
                    {{ form_widget(formVirtualProduct.is_virtual_file) }}
                  </fieldset>
                </div>
              </div>

              <div id="virtual_product_content" class="row col-md-8">
                {{ form_errors(formVirtualProduct) }}
                <div class="col-md-12">
                  <fieldset class="form-group">
                    <label class="form-control-label">{{ formVirtualProduct.file.vars.label }}</label>
                    <span class="help-box" data-toggle="popover"
                          data-content="{{ "Upload a file from your computer (%maxUploadSize% max.)"|trans({'%maxUploadSize%': max_upload_size}, 'Admin.Catalog.Help') }}" ></span>
                    <div id="form_step3_virtual_product_file_input" class="{{ formVirtualProduct.vars.value.filename is defined ? 'hide' : 'show' }}">
                      {{ form_widget(formVirtualProduct.file) }}
                    </div>
                    <div id="form_step3_virtual_product_file_details" class="{{ formVirtualProduct.vars.value.filename is defined ? 'show' : 'hide' }}">
                      <a href="{{ formVirtualProduct.vars.value.file_download_link is defined ? formVirtualProduct.vars.value.file_download_link : '' }}" class="btn btn-default btn-sm download">{{ 'Download file'|trans({}, 'Admin.Actions') }}</a>
                      <a href="{{ path('admin_product_virtual_remove_file_action', {'idProduct': productId}) }}" class="btn btn-danger btn-sm delete">{{ 'Delete this file'|trans({}, 'Admin.Actions') }}</a>
                    </div>
                  </fieldset>
                </div>
                <div class="col-md-6">
                  <fieldset class="form-group">
                    <label class="form-control-label">{{ formVirtualProduct.name.vars.label }}</label>
                    <span class="help-box" data-toggle="popover"
                          data-content="{{ "The full filename with its extension (e.g. Book.pdf)"|trans({}, 'Admin.Catalog.Help') }}" ></span>
                    {{ form_errors(formVirtualProduct.name) }}
                    {{ form_widget(formVirtualProduct.name) }}
                  </fieldset>
                </div>
                <div class="col-md-6">
                  <fieldset class="form-group">
                    <label class="form-control-label">{{ formVirtualProduct.nb_downloadable.vars.label }}</label>
                    <span class="help-box" data-toggle="popover"
                          data-content="{{ "Number of downloads allowed per customer. Set to 0 for unlimited downloads."|trans({}, 'Admin.Catalog.Help') }}" ></span>
                    {{ form_errors(formVirtualProduct.nb_downloadable) }}
                    {{ form_widget(formVirtualProduct.nb_downloadable) }}
                  </fieldset>
                </div>
                <div class="col-md-6">
                  <fieldset class="form-group">
                    <label class="form-control-label">{{ formVirtualProduct.expiration_date.vars.label }}</label>
                    <span class="help-box" data-toggle="popover"
                          data-content="{{ "If set, the file will not be downloadable after this date. Leave blank if you do not wish to attach an expiration date."|trans({}, 'Admin.Catalog.Help') }}" ></span>
                    {{ form_errors(formVirtualProduct.expiration_date) }}
                    {{ form_widget(formVirtualProduct.expiration_date) }}
                  </fieldset>
                </div>
                <div class="col-md-6">
                  <fieldset class="form-group">
                    <label class="form-control-label">{{ formVirtualProduct.nb_days.vars.label }}</label>
                    <span class="help-box" data-toggle="popover"
                          data-content="{{ "Number of days this file can be accessed by customers. Set to zero for unlimited access."|trans({}, 'Admin.Catalog.Help') }}" ></span>
                    {{ form_errors(formVirtualProduct.nb_days) }}
                    {{ form_widget(formVirtualProduct.nb_days) }}
                  </fieldset>
                </div>
                <div class="col-md-12">
                  {{ form_widget(formVirtualProduct.save) }}
                </div>
              </div>
            </div>

            {% if asm_globally_activated and formType.vars.value != "2" %}
              <div class="form-group" id="asm_quantity_management">
                <label class="col-sm-2 control-label" for="form_step3_advanced_stock_management"></label>
                <div class="col-sm-10">
                  {{ form_errors(formAdvancedStockManagement) }}
                  {{ form_widget(formAdvancedStockManagement) }}
                  {% if form.step1.type_product.vars.value == "1" %}
                    {{ 'When enabling advanced stock management for a pack, please make sure it is also enabled for its product(s) – if you choose to decrement product quantities.'|trans({}, 'Admin.Catalog.Notification') }}
                  {% endif %}
                </div>
              </div>
              <div class="form-group" id="depends_on_stock_div" style="{% if not(formAdvancedStockManagement.vars.checked) %}display: none;{% endif %}">
                <label class="col-sm-2 control-label" for="form_step3_depends_on_stock"></label>
                <div class="col-sm-10">
                  {{ form_errors(formDependsOnStocks) }}
                  {{ form_widget(formDependsOnStocks) }}
                </div>
              </div>
            {% endif %}
            {% if 'PS_STOCK_MANAGEMENT'|configuration %}
              <div id="pack_stock_type">
                <h2>{{ formPackStockType.vars.label }}</h2>
                <div class="row col-md-4">
                  <fieldset class="form-group">
                    {{ form_errors(formPackStockType) }}
                    {{ form_widget(formPackStockType) }}
                  </fieldset>
                </div>
              </div>
            {% endif %}
            {{ include('@Product/ProductPage/Forms/form_combinations.html.twig', {'form': formStep3, 'form_combination_bulk': formCombinations}) }}

            {{ renderhook('displayAdminProductsQuantitiesStepBottom', { 'id_product': productId }) }}

          </div>
        </div>
      </div>
    </div>
  </div>
</div>
